//
//  WBFactory.swift
//  SainMicroblog
//
//  Created by chenxinju on 16/5/20.
//  Copyright © 2016年 chenxinju-a2. All rights reserved.
//

import Foundation

class WBFactory {
    
   //工厂模式 系统的button是典型的工厂设计模式
    class func  getbutton(title: String,image: String)->UIButton {
    
        let button = UIButton(type: UIButtonType.Custom)
        
        button.setTitle(title, forState: UIControlState.Normal)
        button.setImage(UIImage(named: image
            ), forState: UIControlState.Normal)
        
        return button
    
    }
  
    
    //系统的NSNuber是典型的抽象工厂模式
    class func getLabel(title:String ,font:CGFloat)->UILabel {
       let label = UILabel()
       label.font = UIFont.systemFontOfSize(font)

        label.text = title
        return label
    }
    
}